Compile To Flash

Configure Menu

The Compile To Flash menu item allows a choice between saved program retention when other programs are run (Compile To Ram) and program capacity (Compile To Flash).

When Compile To Flash is inactive programs are compiled into RAM (Random Access Memory). The menu choice "File | Save In Controller" still saves the program in an area of flash so the controller can autostart. However a saved program with Compile To Flash inactive remains saved even if other programs are run. When the controller is turned off and on again, it will autostart the last program saved in the controller regardless of what other programs might have been run in between. This is convenient since running diagnostic programs does not distrub the configuration of the controller for its deployed purpose. However there is much less RAM available than Flash memory so this only works on smaller projects. This resource listing, viewed by choosing "View | Advanced | Assembly Listing" and scrolling to the bottom shows resources typically available when Compile To Flash is inactive:

In this particular case there are 10000 bytes of data and about 55000 bytes for program code.

If Compile To Flash is active then RAM can be largely committed to data and the larger Flash memory area is available for the program. The tradeoff for this additional capacity is that a program that is saved in the controller will not be retained if another program is run. The menu choice "File | Save In Controller" must be the last action performed on a controller prior to deployment. If another program, such as a diagnostic program, is run then the deployed application must be run again and saved into the controller again. This resource summary is from the same controller and project but with Compile To Flash active:

Now there are almost 57000 of data available (a more than 5 fold improvement) and 459000 bytes for the program (about an 8 fold improvement). Although small compared to a PC those resources would generally be sufficient for several man-years of project development.

If there is insufficient data memory this dialog will appear:

If there is insufficient program memory this dialog will appear:

An editor may open trying to show where the program exceeded available memory.